<link href="css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
<script src="js/plugins/sweetalert/sweetalert.min.js"></script>
	  <!-- 全局js -->
    <script src="js/jquery.min.js?v=2.1.4"></script>
    <script src="js/bootstrap.min.js?v=3.3.6"></script>



    <!-- ECharts -->
    <script src="js/plugins/echarts/echarts-all.js"></script>

    <!-- 自定义js -->
    <script src="js/content.js?v=1.0.0"></script>


    <!-- ECharts demo data -->
    <script src="js/demo/echarts-demo.js"></script>
<?php
/*
项目名称：在线简历填写+公众号简历状态实时推送查询系统
微信消息接口开发：@刘继鹏Beta
程序开发：@刘继鹏Beta
前端设计:@刘继鹏Beta
MYSQL：@刘继鹏Beta
开发日期：2017/02/13
*/
error_reporting(0);
header("Content-Type: text/html; charset=UTF-8");
session_start();
		if(time() - $_SESSION['time'] >1800){
		unset($_SESSION['username']);
unset($_SESSION['passcode']);
unset($_SESSION['userflag']);
		unset($_SESSION['time']);
	}
if(isset($_SESSION['username']))

{

include('wx_config.php');
$id= $_POST['id'];
 $result = mysql_query("SELECT * FROM LJ_data WHERE id  LIKE '$id'  limit 0,1");
	while($row = mysql_fetch_array($result)) 	{
	 $opid=$row['opid'];
         $xm=$row['xm'];
		$tuisong=$row['tuisong'];
	}
$zhuangtai=$_POST['zhuangtai'];
$pingyu= $_POST['pingyu'];
	$riqi= $_POST['riqi'];
 mysql_query("UPDATE  `jianli`.`lj_data` SET  `zhuangtai` =  '$zhuangtai',
`pingyu` =  '$pingyu',`riqi` =  '$riqi' WHERE  `lj_data`.`id` =$id");
if($zhuangtai=='通过'){
	if($tuisong==0){
 $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=".$app;
 $data='{
    "touser": "'.$opid.'", 
     "msgtype":"news",
    "news":{
        "articles": [
         { "title":"简历状态审核成功通知",
             "description":"亲爱的'.$xm.'\n\n恭喜你已成功加入轻扫商户宝集团\n\n入职日期：'.$riqi.'\n\n以下为注意事项\n\n以下为入职须知\n",
         }]}}';
 $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url); 
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($curl);
curl_close($ch);	
		mysql_query("UPDATE  `jianli`.`lj_data` SET  `tuisong` =  '1' WHERE  `lj_data`.`id` =$id");
}}
if($zhuangtai=='未通过'){
	if($tuisong==0){
 $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=".$app;
 $data='{
    "touser": "'.$opid.'", 
     "msgtype":"news",
    "news":{
        "articles": [
         { "title":"简历状态审核失败通知",
             "description":"亲爱的'.$xm.'\n\n很遗憾你没有通过本次面试\n\n祝你早日找到理想工作\n",
         }]}}';
 $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url); 
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($curl);
curl_close($ch);	
mysql_query("UPDATE  `jianli`.`lj_data` SET  `tuisong` =  '1' WHERE  `lj_data`.`id` =$id");
}}
  exit( ' <script>$(document).ready(function () { swal({title: 
	"保存成功",
                    type: "success"
					
                }, function() {location.href=document.referrer;});
          
        });
    </script>');
}
else
{
     exit( ' <script>$(document).ready(function () { swal({title: 
	"抱歉，你还未登录哦！",
                    type: "error"
					
                }, function() {location.href="login.php";});
          
        });
    </script>');
}
?>